package icu.jiapeng.DemoJava;

import icu.jiapeng.DemoJava.interfaces.WithCodeEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;

public class Demo1 {
    @Getter
    @AllArgsConstructor
    public enum Color implements WithCodeEnum {
        RED(1),
        GREEN(2),
        BLUE(3);

        private final int code;
    }

    public static void main(String[] args) {
        Color enumByCode = WithCodeEnum.getEnumByCode(Color.class, 1);
        System.out.println("enumByCode = " + enumByCode);
    }
}
